package com.walle.common.page;

import java.io.Serializable;

/**
 * 
 * Title: PageParam.java    
 * Description: 分页参数传递工具类 .
 * @author Fan Shizhen (Derek)       
 * @created 2016年3月25日 下午9:24:31
 */
public class PageParam implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6297178964005032338L;
	private int pageNum = 1; // 当前页数
	private int numPerPage = 15; // 每页记录数

	private int startRow = 0; // 起始行
	private int endRow = 0; // 结束行
	private int offset = 0; // 偏移量  oracle 的起始行 +1  mysql不需要

	private String orderBy = "";
	public PageParam(int pageNum) {
		super();
		this.pageNum = pageNum;
	}

	public PageParam(int startRow, int numPerPage) {
		this.pageNum = startRow/numPerPage;
		this.numPerPage = numPerPage;
		this.startRow = startRow + offset;
		this.endRow = startRow + numPerPage;
	}
	public PageParam(int startRow, int numPerPage, String orderBy) {
		this(startRow,  numPerPage);
		this.orderBy = orderBy;
	}

	public int getStartRow() {
		return startRow;
	}

	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}

	public int getEndRow() {
		return endRow;
	}

	public void setEndRow(int endRow) {
		this.endRow = endRow;
	}



	/** 当前页数 */
	public int getPageNum() {
		return pageNum;
	}

	/** 当前页数 */
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	/** 每页记录数 */
	public int getNumPerPage() {
		return numPerPage;
	}
	/** 每页记录数 */
	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}

	public String getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}
}
